<script setup>
defineProps({
  titles: {
    type: Array,
    default: () => []
  },
  showBack: {
    type: Boolean,
    default: true
  }
})
</script>

<template>
  <div class="breadcrumb-wrap">
    <div
      class="icon"
      @click="$router.go(-1)"
      v-if="showBack"
    >
      <i class="el-icon-arrow-left"></i>
    </div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item
        v-for="title in titles"
        :key="title"
        >{{ title }}</el-breadcrumb-item
      >
    </el-breadcrumb>
  </div>
</template>

<style lang="scss" scoped>
.breadcrumb-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 50px;
  border-bottom: 1px solid #f1f1f1;
  flex: 0 0 auto;
  padding-left: 10px;
  .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #497fa3;
    font-size: 14px;
    border-radius: 50%;
    color: #497fa3;
    cursor: pointer;
    margin-right: 10px;
  }
  .el-breadcrumb {
    margin-bottom: 0;
    font-size: 14px;
    font-family: PingFang SC;
    font-weight: 400;
    color: #4c565c;
  }
}
</style>
